clear all;
image1=imread('fig6.tif');
[n,m]=size(image1);
subplot(2,2,1);
imshow(image1);
title('原始图像');
subplot(2,2,2);
imhist(image1);
title('原图像的直方图');
background=uint8(zeros(n,m));
for i=1:n
    for j=1:m
        if image1(i,j)<=60
          background(i,j)=image1(i,j);
        end
    end
end

subplot(2,2,3);
imshow(background);
title('背景图');
result=imsubtract(image1,background);
subplot(2,2,4);
imshow(result);
title('结果');



